import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import _split from "lodash/split";
import _set from "lodash/set";
import _omit from "lodash/omit";
import _map from "lodash/map";
import _isFunction from "lodash/isFunction";
import _isEmpty from "lodash/isEmpty";
import _forEach from "lodash/forEach";

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _class3;

/**
 * index.js
 * @date 2018/10/24
 */
// 带数据源的 Table
import React from 'react';
import { Table } from 'antd';
import { Bind } from 'lodash-decorators';
import { withRouter } from 'dva/router';
import querystring from 'querystring';
import intl from "../../../utils/intl";
import { createPagination, getResponse, parseParameters } from "../../../utils/utils";
import notification from "../../../utils/notification";
import request from "../../../utils/request";
import { operatorRender } from "../../../utils/renderer";
import { actionCode, openPageModalBodyStyle, openTypeCode, paramTypeCode } from "./utils";
import { dealObjectProps, getContextValue, getDisplayValue, getWidthFromWord, preProcessComponentProps, get } from "../utils";
import { dynamicTableOmitProps, fieldLabelProp, fieldNameProp, subEventSep } from "../config";

function fetchGet(_x) {
  return _fetchGet.apply(this, arguments);
}

function _fetchGet() {
  _fetchGet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
    var url, query, body;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            url = _ref.url, query = _ref.query, body = _ref.body;
            return _context.abrupt("return", request(url, {
              method: 'GET',
              query: query,
              body: body
            }));

          case 2:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _fetchGet.apply(this, arguments);
}

function fetchDelete(_x2) {
  return _fetchDelete.apply(this, arguments);
}

function _fetchDelete() {
  _fetchDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
    var url, query, body;
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            url = _ref2.url, query = _ref2.query, body = _ref2.body;
            return _context2.abrupt("return", request(url, {
              method: 'DELETE',
              query: query,
              body: body
            }));

          case 2:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _fetchDelete.apply(this, arguments);
}

var linkButtonStyle = {
  marginRight: 8
};
var DynamicTable = (_dec = Bind(), _dec2 = Bind(), _dec3 = Bind(), _dec4 = Bind(), _dec5 = Bind(), _dec6 = Bind(), _dec7 = Bind(), _dec8 = Bind(), _dec9 = Bind(), _dec10 = Bind(), _dec11 = Bind(), withRouter(_class = (_class2 = (_class3 = /*#__PURE__*/function (_React$Component) {
  _inherits(DynamicTable, _React$Component);

  var _super = _createSuper(DynamicTable);

  function DynamicTable(props) {
    var _this;

    _classCallCheck(this, DynamicTable);

    _this = _super.call(this, props); // 初始化state

    _this.pageModalRef = void 0;
    _this.state = {
      queryParams: {},
      pagingDataSource: {},
      ds: !!props.queryUrl,
      // 是不是自带数据源的Table(queryUrl)
      pageModalProps: {} // 页面模态框

    };
    return _this;
  }

  _createClass(DynamicTable, [{
    key: "handlePageModalRef",
    value: function handlePageModalRef(pageModalRef) {
      this.pageModalRef = pageModalRef;
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props = this.props,
          batchRemoveUrl = _this$props.batchRemoveUrl,
          rowKey = _this$props.rowKey,
          userRowSelection = _this$props.rowSelection,
          _this$props$paginatio = _this$props.pagination;
      _this$props$paginatio = _this$props$paginatio === void 0 ? {} : _this$props$paginatio;
      var _this$props$paginatio2 = _this$props$paginatio.showTotal,
          showTotal = _this$props$paginatio2 === void 0 ? true : _this$props$paginatio2,
          _this$props$paginatio3 = _this$props$paginatio.showSizeChanger,
          showSizeChanger = _this$props$paginatio3 === void 0 ? true : _this$props$paginatio3,
          pageSizeOptions = _this$props$paginatio.pageSizeOptions,
          userPagination = _this$props.pagination,
          _this$props$scroll = _this$props.scroll,
          scroll = _this$props$scroll === void 0 ? {} : _this$props$scroll,
          _this$props$dataSourc = _this$props.dataSource,
          userDataSource = _this$props$dataSourc === void 0 ? {} : _this$props$dataSourc,
          _this$props$loading = _this$props.loading,
          loading = _this$props$loading === void 0 ? false : _this$props$loading;
      var _this$state = this.state,
          _this$state$selectedR = _this$state.selectedRowKeys,
          selectedRowKeys = _this$state$selectedR === void 0 ? [] : _this$state$selectedR,
          _this$state$pagingDat = _this$state.pagingDataSource,
          pagingDataSource = _this$state$pagingDat === void 0 ? {} : _this$state$pagingDat,
          ds = _this$state.ds,
          pageModalProps = _this$state.pageModalProps,
          queryLoading = _this$state.queryLoading,
          lineRemoveLoading = _this$state.lineRemoveLoading;
      var tableLoading = queryLoading || loading || lineRemoveLoading;

      var otherProps = _omit(this.props, dynamicTableOmitProps);

      var rowSelection = batchRemoveUrl ? _objectSpread(_objectSpread({}, userRowSelection), {}, {
        selectedRowKeys: selectedRowKeys,
        onChange: this.handleRowSelectionChange
      }) : undefined;
      var pagination;
      var dataSource;

      if (ds) {
        dataSource = pagingDataSource && pagingDataSource.content || [];
        pagination = userPagination === false ? false : createPagination(pagingDataSource) || false;

        if (pagination) {
          if (!showTotal) {
            delete pagination.showTotal;
          }

          if (showSizeChanger) {
            if (!_isEmpty(pageSizeOptions)) {
              pagination.pageSizeOptions = pageSizeOptions;
            }
          } else {
            delete pagination.showSizeChanger;
          }
        }
      } else {
        dataSource = userDataSource && userDataSource.content || [];
        pagination = userPagination === false ? false : createPagination(userDataSource) || false;

        if (pagination) {
          if (!showTotal) {
            delete pagination.showTotal;
          }

          if (showSizeChanger) {
            if (!_isEmpty(pageSizeOptions)) {
              pagination.pageSizeOptions = pageSizeOptions;
            }
          } else {
            delete pagination.showSizeChanger;
          }
        }
      }

      var _this$getColumnsAndSc = this.getColumnsAndScrollX(),
          columns = _this$getColumnsAndSc.columns,
          x = _this$getColumnsAndSc.x;

      scroll.x = x;
      var DynamicModal = get('DynamicModal');
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table, Object.assign({
        key: "dataSetTable"
      }, otherProps, {
        rowSelection: rowSelection,
        pagination: pagination,
        dataSource: dataSource,
        onChange: this.handleTableChange,
        columns: columns,
        scroll: scroll,
        rowKey: rowKey,
        loading: tableLoading,
        bordered: true
      })), /*#__PURE__*/React.createElement(DynamicModal, Object.assign({}, pageModalProps, {
        key: "pageModal",
        onRef: this.handlePageModalRef
      })));
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props2 = this.props,
          onRef = _this$props2.onRef,
          _this$props2$defaultP = _this$props2.defaultPageSize,
          defaultPageSize = _this$props2$defaultP === void 0 ? 10 : _this$props2$defaultP;

      if (_isFunction(onRef)) {
        onRef(this);
      }

      this.query({
        page: 0,
        size: defaultPageSize
      });
    }
  }, {
    key: "showLoading",
    value: function showLoading(loading) {
      this.setState(_defineProperty({}, loading, true));
    }
  }, {
    key: "hiddenLoading",
    value: function hiddenLoading(loading) {
      this.setState(_defineProperty({}, loading, true));
    }
  }, {
    key: "handleAddBtnClick",
    value: function handleAddBtnClick() {
      var onAdd = this.props.onAdd;

      if (_isFunction(onAdd)) {
        onAdd();
      }
    }
  }, {
    key: "handleRowSelectionChange",
    value: function handleRowSelectionChange(_) {
      var selectedRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
      var _this$props3 = this.props,
          rowKey = _this$props3.rowKey,
          _this$props3$rowSelec = _this$props3.rowSelection;
      _this$props3$rowSelec = _this$props3$rowSelec === void 0 ? {} : _this$props3$rowSelec;
      var onChange = _this$props3$rowSelec.onChange;

      var selectedRowKeys = _map(selectedRows, function (record) {
        return record[rowKey];
      });

      this.setState({
        selectedRowKeys: selectedRowKeys,
        selectedRows: selectedRows
      });

      if (_isFunction(onChange)) {
        onChange(selectedRowKeys, selectedRows);
      }
    }
  }, {
    key: "handleTableChange",
    value: function handleTableChange(pagination, filter, sorter) {
      var ds = this.state.ds;
      var paginationParams = {
        page: pagination,
        sort: sorter
      };

      if (ds) {
        return this.query(paginationParams);
      }

      return Promise.reject();
    }
  }, {
    key: "reload",
    value: function reload() {
      var _this$state2 = this.state,
          queryParams = _this$state2.queryParams,
          ds = _this$state2.ds;

      if (ds) {
        return this.query(queryParams);
      }

      return Promise.reject();
    }
    /**
     * @export 给页面其他组件使用
     * @param {object} queryParams - 分页信息
     * @return Promise
     */

  }, {
    key: "query",
    value: function query() {
      var _this2 = this;

      var queryParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      this.setState({
        queryParams: queryParams
      });
      var ds = this.state.ds;
      var _this$props4 = this.props,
          context = _this$props4.context,
          queryForm = _this$props4.queryForm;
      var form = getContextValue(context, queryForm);

      if (form && _isFunction(form.validateFields)) {
        // 有查询表单
        return new Promise(function (resolve, reject) {
          form.validateFields(function (err, fieldsValue) {
            if (err) {
              reject(err);
            } else {
              // 处理查询参数
              var _parsedParameters = parseParameters(queryParams); // 相当于常量查询条件


              var nowParams = _objectSpread(_objectSpread({}, _parsedParameters), fieldsValue);

              if (ds) {
                return _this2.fetch(nowParams).then(resolve, reject);
              }

              return resolve();
            }
          });
        });
      } // 处理查询参数


      var parsedParameters = parseParameters(queryParams);

      if (ds) {
        return this.fetch(parsedParameters);
      }

      return Promise.resolve();
    }
    /**
     * 调用 queryUrl 查询数据
     * @param {Object} queryParams
     */

  }, {
    key: "fetch",
    value: function fetch() {
      var _this3 = this;

      var queryParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _this$props$defaultPa = this.props.defaultPageSize,
          defaultPageSize = _this$props$defaultPa === void 0 ? 10 : _this$props$defaultPa;
      this.setState({
        queryLoading: true
      });
      var queryUrl = this.props.queryUrl;
      return fetchGet({
        url: queryUrl,
        query: _objectSpread({
          page: 0,
          size: defaultPageSize
        }, queryParams)
      }).then(function (res) {
        var data = getResponse(res);

        if (data) {
          _this3.setState({
            pagingDataSource: data
          });
        }

        return data;
      }).finally(function () {
        _this3.setState({
          queryLoading: false
        });
      });
    }
    /**
     * @param {object} removeRecord - 要删除的记录
     */

  }, {
    key: "handleLineRemove",
    value: function handleLineRemove(removeRecord) {
      var _this4 = this;

      //
      var _this$props5 = this.props,
          removeUrl = _this$props5.removeUrl,
          batchRemoveUrl = _this$props5.batchRemoveUrl;
      this.showLoading('lineRemoveLoading');

      if (removeUrl) {
        if (removeRecord) {
          return fetchDelete({
            url: removeUrl,
            // body: [removeRecord],
            body: removeRecord
          }).then(function (response) {
            var res = getResponse(response);

            if (res) {
              _this4.query();
            }

            return res;
          }).finally(function () {
            _this4.hiddenLoading('lineRemoveLoading');
          });
        }

        notification.warning({
          message: intl.get('cpaas.common.components.dynamicTable.notification.illegal').d('非法的调用, 请联系管理员')
        });
        return Promise.reject(new Error(intl.get('cpaas.common.components.dynamicTable.notification.illegal').d('非法的调用, 请联系管理员')));
      }

      if (batchRemoveUrl) {
        if (removeRecord) {
          return fetchDelete({
            url: batchRemoveUrl,
            body: [removeRecord]
          }).then(function (response) {
            var res = getResponse(response);

            if (res) {
              _this4.query();
            } else {
              // todo 删除失败 需要 reject
              throw new Error('删除失败');
            }

            return res;
          }).finally(function () {
            _this4.hiddenLoading('lineRemoveLoading');
          });
        }

        notification.warning({
          message: intl.get('cpaas.common.components.dynamicTable.notification.illegal').d('非法的调用, 请联系管理员')
        });
        return Promise.reject(new Error(intl.get('cpaas.common.components.dynamicTable.notification.illegal').d('非法的调用, 请联系管理员')));
      }

      notification.warning({
        message: intl.get('cpaas.common.components.dynamicTable.notification.url').d('表格没有提供删除URL')
      });
      this.hiddenLoading('lineRemoveLoading');
      return Promise.reject(new Error(intl.get('cpaas.common.components.dynamicTable.notification.urlOrMore').d('表格没有提供 删除URL 或 批量删除URL')));
    }
  }, {
    key: "remove",
    value: function remove() {
      var _this5 = this;

      var removeUrl = this.props.removeUrl;
      this.showLoading('removeLoading');

      if (removeUrl) {
        var selectedRows = this.getRows();

        if (selectedRows && selectedRows.length > 0) {
          return fetchDelete({
            url: removeUrl,
            body: selectedRows
          }).then(function (deleteResponse) {
            var res = getResponse(deleteResponse);

            if (res) {
              _this5.query();
            } else {
              // todo 删除失败要报错
              throw new Error('删除失败');
            }

            return res;
          });
        }

        notification.warning({
          message: intl.get('cpaas.common.components.dynamicTable.notification.Selected').d('没有选中要删除的数据')
        });
        return Promise.reject(new Error(intl.get('cpaas.common.components.dynamicTable.notification.Selected').d('没有选中要删除的数据')));
      }

      this.hiddenLoading('removeLoading');
      return Promise.reject(new Error(intl.get('cpaas.common.components.dynamicTable.notification.urls').d('表格没有提供批量删除URL')));
    }
  }, {
    key: "getColumnsAndScrollX",
    value: function getColumnsAndScrollX() {
      var _this6 = this;

      var _this$props6 = this.props,
          context = _this$props6.context,
          fields = _this$props6.fields;
      var columnsWidth = 0;
      var hasAutoWidth = false;

      var columns = _map(fields, function (field) {
        var dealFieldProps = dealObjectProps(field, context);
        var componentProps = preProcessComponentProps({
          field: field,
          context: context
        });
        var isAutoWidth = +dealFieldProps.width === 0; // autoWidth field

        var columnWidth = +dealFieldProps.width || getWidthFromWord({
          word: field[fieldLabelProp]
        });
        var column = {
          dataIndex: field[fieldNameProp],
          title: field[fieldLabelProp],
          align: dealFieldProps.align,
          render: function render(_, record) {
            return getDisplayValue({
              field: field,
              dataSource: record,
              componentProps: componentProps
            });
          }
        };

        if (isAutoWidth) {
          hasAutoWidth = true;
          columnsWidth += 120;
        } else {
          column.width = columnWidth;
          columnsWidth += columnWidth;
        }

        switch (field.componentType) {
          case 'LinkButton':
            column.render = function (_, record) {
              var btns = {};

              _forEach(componentProps, function (prop, propKey) {
                _set(btns, propKey, prop);
              }); // todo 按钮按钮的顺序


              var linkBtns = [];

              _forEach(btns, function (btnProps) {
                var btnKey = btnProps.btnKey;
                var modalProps = {};
                var onBtnClick;

                switch (btnProps.action) {
                  case actionCode.page:
                    // 打开 Modal 或 页面
                    switch (btnProps.openType) {
                      case openTypeCode.inner:
                        // 跳转
                        break;

                      case openTypeCode.modal:
                        // 打开 Modal
                        modalProps.type = openTypeCode.modal;
                        modalProps.bodyStyle = openPageModalBodyStyle[btnProps.openPageTypeModal].bodyStyle;
                        modalProps.width = openPageModalBodyStyle[btnProps.openPageTypeModal].width;
                        modalProps.modalBtns = btnProps.modalBtns; // modal 按钮
                        // 订阅事件

                        if (btnProps.subEvents) {
                          _forEach(btnProps.subEvents, function (subEvent) {
                            var _split2 = _split(subEvent, subEventSep),
                                _split3 = _slicedToArray(_split2, 2),
                                subEventListenStr = _split3[0],
                                subEventActionStr = _split3[1];

                            var subEventAction = getContextValue(context, subEventActionStr);

                            if (_isFunction(subEventAction)) {
                              modalProps[subEventListenStr] = subEventAction;
                            }
                          });
                        }

                        break;

                      case openTypeCode.drawer:
                        // 打开 侧滑Modal
                        modalProps.type = openTypeCode.drawer;
                        modalProps.width = btnProps.openPageTypeDrawer;
                        modalProps.modalBtns = btnProps.modalBtns; // modal 按钮
                        // 订阅事件

                        if (btnProps.subEvents) {
                          _forEach(btnProps.subEvents, function (subEvent) {
                            var _split4 = _split(subEvent, subEventSep),
                                _split5 = _slicedToArray(_split4, 2),
                                subEventListenStr = _split5[0],
                                subEventActionStr = _split5[1];

                            var subEventAction = getContextValue(context, subEventActionStr);

                            if (_isFunction(subEventAction)) {
                              modalProps[subEventListenStr] = subEventAction;
                            }
                          });
                        }

                        break;

                      default:
                        break;
                    }

                    onBtnClick = function onBtnClick(e) {
                      e.preventDefault();
                      var params = {};
                      var search = _this6.props.history.search;
                      var urlParams = querystring.parse(search);
                      var paramStream = (btnProps.params || '').split(',');

                      for (var i = 1; i <= paramStream.length; i++) {
                        if (i % 3 === 0) {
                          switch (paramStream[i - 2]) {
                            case paramTypeCode.fixParam:
                              params[paramStream[i - 3]] = paramStream[i - 1];
                              break;

                            case paramTypeCode.urlParam:
                              params[paramStream[i - 1]] = urlParams[paramStream[i - 3]];
                              break;

                            case paramTypeCode.columnParam:
                              params[paramStream[i - 1]] = record[paramStream[i - 3]];
                              break;

                            default:
                              break;
                          }
                        }
                      }

                      _this6.setState({
                        pageModalProps: _objectSpread({
                          pageCode: btnProps.pageCode
                        }, modalProps)
                      });

                      if (_this6.pageModalRef) {
                        _this6.pageModalRef.init(params);

                        _this6.pageModalRef.show();
                      }
                    };

                    break;

                  case actionCode.action:
                    // 自定义动作
                    onBtnClick = function onBtnClick() {
                      if (btnProps.actionEvent === internalFuncsInfo.lineRemove.code) {
                        _this6.handleLineRemove(record).catch(function
                          /* e */
                        () {// console.error(e);
                        });
                      }
                    }; // Table 的动作, 删除行 ...
                    // 其他事件


                    break;

                  default:
                    break;
                }

                linkBtns[btnProps.orderSeq] = {
                  key: btnKey,
                  ele: /*#__PURE__*/React.createElement("a", {
                    onClick: onBtnClick,
                    style: linkButtonStyle
                  }, btnProps.title),
                  len: btnProps.title && btnProps.title.length || 4,
                  title: btnProps.title || null
                };
              });

              return operatorRender(linkBtns.filter(Boolean));
            };

            break;

          default:
            break;
        }

        return column;
      });

      if (hasAutoWidth) {
        return {
          columns: columns
        };
      }

      return {
        scroll: {
          x: columnsWidth
        },
        columns: columns
      };
    }
  }, {
    key: "getRows",
    value: function getRows() {
      var _this$state$selectedR2 = this.state.selectedRows,
          selectedRows = _this$state$selectedR2 === void 0 ? [] : _this$state$selectedR2;
      return selectedRows;
    }
  }, {
    key: "getRowKeys",
    value: function getRowKeys() {
      var _this$state$selectedR3 = this.state.selectedRowKeys,
          selectedRowKeys = _this$state$selectedR3 === void 0 ? [] : _this$state$selectedR3;
      return selectedRowKeys;
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps
    /* , prevState */
    ) {
      // 根据属性来判断是不是 queryUrl(自带数据源的Table), 或者由父组件控制的 Table
      var queryUrl = nextProps.queryUrl;
      var nextState = {};
      nextState.ds = !!queryUrl;
      return nextState;
    }
  }]);

  return DynamicTable;
}(React.Component), _class3.defaultProps = {}, _class3), (_applyDecoratedDescriptor(_class2.prototype, "handlePageModalRef", [_dec], Object.getOwnPropertyDescriptor(_class2.prototype, "handlePageModalRef"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "showLoading", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "showLoading"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "hiddenLoading", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "hiddenLoading"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleAddBtnClick", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "handleAddBtnClick"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleRowSelectionChange", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "handleRowSelectionChange"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleTableChange", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "handleTableChange"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "reload", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "reload"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "query", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "query"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetch", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "fetch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleLineRemove", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "handleLineRemove"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "remove", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "remove"), _class2.prototype)), _class2)) || _class);
export { DynamicTable as default };
var exportFuncs = ['reload', 'query', 'remove'];
var exportFuncsInfo = {
  reload: {
    descriptionIntlCode: 'cpfm.ui.tpl.table.reload',
    descriptionIntlDefault: intl.get('cpaas.common.button.reload').d('重新加载'),
    code: 'reload'
  },
  query: {
    descriptionIntlCode: 'cpfm.ui.tpl.table.query',
    descriptionIntlDefault: intl.get('cpaas.common.button.search').d('查询'),
    code: 'query'
  },
  remove: {
    descriptionIntlCode: 'cpfm.ui.tpl.table.remove',
    descriptionIntlDefault: intl.get('cpaas.common.button.delete').d('删除'),
    code: 'remove'
  }
};
var internalFuncs = ['lineRemove'];
var internalFuncsInfo = {
  lineRemove: {
    descriptionIntlCode: 'cpfm.ui.tpl.table.internal.lineRemove',
    descriptionIntlDefault: intl.get('cpaas.common.button.deleteLine').d('删除行'),
    code: 'lineRemove'
  }
}; // 暴露出去的方法

DynamicTable.exportFuncs = exportFuncs;
DynamicTable.exportFuncsInfo = exportFuncsInfo; // 行内按钮事件

DynamicTable.internalFuncs = internalFuncs;
DynamicTable.internalFuncsInfo = internalFuncsInfo;